/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="express")
public class Express implements Serializable {
	public Express() {
	}
	
	private int id;
	
	private String code;
	
	private String name;
	
	private Integer first;
	
	private Integer firstPrice;
	
	private Integer additional;
	
	private Integer additionalPrice;
	
	private Byte state;
	
	private cn.imvc.app.entities.Seller seller;
	
	private Byte isDefault;
	
	private java.util.Set storageOrder = new java.util.HashSet();
	
	private java.util.Set expressFee = new java.util.HashSet();
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_EXPRESS_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_EXPRESS_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 编码
	 */
	public void setCode(String value) {
		this.code = value;
	}
	
	/**
	 * 编码
	 */
	@Column(name="code", nullable=true, length=255)	
	public String getCode() {
		return code;
	}
	
	/**
	 * 快递名称
	 */
	public void setName(String value) {
		this.name = value;
	}
	
	/**
	 * 快递名称
	 */
	@Column(name="name", nullable=true, length=255)	
	public String getName() {
		return name;
	}
	
	/**
	 * 默认首重克
	 */
	public void setFirst(int value) {
		setFirst(new Integer(value));
	}
	
	/**
	 * 默认首重克
	 */
	public void setFirst(Integer value) {
		this.first = value;
	}
	
	/**
	 * 默认首重克
	 */
	@Column(name="first", nullable=true, length=10)	
	public Integer getFirst() {
		return first;
	}
	
	/**
	 * 默认首重价格
	 */
	public void setFirstPrice(int value) {
		setFirstPrice(new Integer(value));
	}
	
	/**
	 * 默认首重价格
	 */
	public void setFirstPrice(Integer value) {
		this.firstPrice = value;
	}
	
	/**
	 * 默认首重价格
	 */
	@Column(name="firstPrice", nullable=true, length=10)	
	public Integer getFirstPrice() {
		return firstPrice;
	}
	
	/**
	 * 默认续重克
	 */
	public void setAdditional(int value) {
		setAdditional(new Integer(value));
	}
	
	/**
	 * 默认续重克
	 */
	public void setAdditional(Integer value) {
		this.additional = value;
	}
	
	/**
	 * 默认续重克
	 */
	@Column(name="additional", nullable=true, length=10)	
	public Integer getAdditional() {
		return additional;
	}
	
	/**
	 * 默认续重价格
	 */
	public void setAdditionalPrice(int value) {
		setAdditionalPrice(new Integer(value));
	}
	
	/**
	 * 默认续重价格
	 */
	public void setAdditionalPrice(Integer value) {
		this.additionalPrice = value;
	}
	
	/**
	 * 默认续重价格
	 */
	@Column(name="additionalPrice", nullable=true, length=10)	
	public Integer getAdditionalPrice() {
		return additionalPrice;
	}
	
	/**
	 * 状态
	 */
	public void setState(byte value) {
		setState(new Byte(value));
	}
	
	/**
	 * 状态
	 */
	public void setState(Byte value) {
		this.state = value;
	}
	
	/**
	 * 状态
	 */
	@Column(name="state", nullable=true)	
	public Byte getState() {
		return state;
	}
	
	public void setIsDefault(byte value) {
		setIsDefault(new Byte(value));
	}
	
	public void setIsDefault(Byte value) {
		this.isDefault = value;
	}
	
	@Column(name="isDefault", nullable=true)	
	public Byte getIsDefault() {
		return isDefault;
	}
	
	public void setSeller(cn.imvc.app.entities.Seller value) {
		this.seller = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Seller.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="sellerId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Seller getSeller() {
		return seller;
	}
	
	public void setStorageOrder(java.util.Set value) {
		this.storageOrder = value;
	}
	
	@OneToMany(mappedBy="express", targetEntity=cn.imvc.app.entities.StorageOrder.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getStorageOrder() {
		return storageOrder;
	}
	
	
	public void setExpressFee(java.util.Set value) {
		this.expressFee = value;
	}
	
	@OneToMany(mappedBy="express", targetEntity=cn.imvc.app.entities.ExpressFee.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getExpressFee() {
		return expressFee;
	}
	
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Express[ ");
			sb.append("Id=").append(getId()).append(" ");
			sb.append("Code=").append(getCode()).append(" ");
			sb.append("Name=").append(getName()).append(" ");
			sb.append("First=").append(getFirst()).append(" ");
			sb.append("FirstPrice=").append(getFirstPrice()).append(" ");
			sb.append("Additional=").append(getAdditional()).append(" ");
			sb.append("AdditionalPrice=").append(getAdditionalPrice()).append(" ");
			sb.append("State=").append(getState()).append(" ");
			if (getSeller() != null)
				sb.append("Seller.Persist_ID=").append(getSeller().toString(true)).append(" ");
			else
				sb.append("Seller=null ");
			sb.append("IsDefault=").append(getIsDefault()).append(" ");
			sb.append("StorageOrder.size=").append(getStorageOrder().size()).append(" ");
			sb.append("ExpressFee.size=").append(getExpressFee().size()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
